﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace BlogBobby
{
    public class CommentDTO
    {
        public int CommentID { get; set; }
        public string Author { get; set; }
        public DateTime Date { get; set; }
        public string Body { get; set; }
        public int PostID { get; set; }

        public static CommentDTO CreateFromComment(Comment comment)
        {
            CommentDTO res = new CommentDTO();
            res.Author = comment.Author;
            res.CommentID = comment.CommentID;
            res.Date = comment.Date;
            res.Body = comment.Body;
            res.PostID = comment.PostID;
            return res;
        }

        public Comment ToComment()
        {
            Comment res = new Comment();
            res.Author = this.Author;
            res.CommentID = this.CommentID;
            res.Date = this.Date;
            res.Body = this.Body;
            res.PostID = this.PostID;
            return res;
        }
    }
}